#ifndef RECORDENGINE_H_INCLUDED
#define RECORDENGINE_H_INCLUDED

#include <fftw3.h>
#include "tabview.h"
#include "song.h"
using namespace std;

class recordEngine : public wxThread {
  public:
    // functions
    recordEngine(float theFrequency, int duration, wxTextCtrl* theTxtDebug, int theNoteNr,
                note* theNewNote, tabView *theTabViewInit, wxGauge *theGaugeInit, int theRecordType, wxSpinCtrl *theSpnTreshold);
    virtual void *Entry();
    virtual void OnExit();
    // variables
    int sampleRate, NUMPTS, noteNr;
    float frequency;        // the frequency that we are searching for
    unsigned char* waveIn;  // dynamic bufffer
    MMRESULT result;
    tabView   *theTabView;
    HWAVEIN      hWaveIn;
    WAVEHDR      WaveInHdr;
    WAVEFORMATEX pFormat;
    fftw_complex *in, *out;
    fftw_plan p;
    wxTextCtrl* txtDebug;
    note* theNote;
    wxGauge   *theGauge;
    int theDuration;
    int recordType;         // 0 = normal recording with frequency checking, 1 = treshold
    wxSpinCtrl *spnTreshold;
};

#endif // RECORDENGINE_H_INCLUDED
